home *** CD-ROM | disk | FTP | other *** search
/ Amiga Plus 1995 #5 & #6 / Amiga Plus CD - 1995 - No. 5 and 6.iso / pd / serien / purity / nr.43 / localedemo / locale.p < prev    next >
Text File  |  1995-01-05  |  1KB  |  57 lines

  1. Program LocaleDemo;
  2.  
  3. { 1994 by Andreas Tetzl }
  4. { Public Domain }
  5. { Für OS2.1+ }
  6. { Zum Übersetzen werden die OS3.1 Includes 
  7.   von der Purity benötigt ! }
  8.  
  9.  
  10. {$I "Include:Libraries/Locale.i"}
  11. {$I "Include:Exec/Libraries.i"}
  12. {$I "Include:Utils/StringLib.i"}
  13.  
  14. CONST DefStrings : Array[0..2] of String = (
  15.                     "LocaleDemo V1.0 1994 by Andreas Tetzl",
  16.                     "This program demonstrates the use of the locale.library.",
  17.                     "This is the default text.");
  18.  
  19. VAR Loc : LocalePtr;
  20.     Cat : CatalogPtr;
  21.     StrNum : Integer;
  22.     Str : String;
  23.  
  24. Procedure CleanExit(Why : String; RC : Integer);
  25. Begin
  26.  If cat<>NIL then CloseCatalog(cat);
  27.  If loc<>NIL then CloseLocale(loc);
  28.  If LocaleBase<>NIL then CloseLibrary(LocaleBase);
  29.  If Why<>NIL then Writeln(Why);
  30.  Exit(RC);
  31. end;
  32.  
  33. Begin
  34.  { Als erstes die locale.library öffnen. }
  35.  LocaleBase := OpenLibrary("locale.library", 38);
  36.  If LocaleBase=NIL then CleanExit("Benötige OS2.1+",10);
  37.  
  38.  { Zugriff auf die voreingestellte Sprache. }
  39.  { Sollte für dieses Programm Deutsch sein. }
  40.  loc := OpenLocale(NIL);
  41.  If loc=NIL then CleanExit("Keinen Zugriff auf voreingestellte Sprache",10);
  42.  
  43.  cat := OpenCatalogA(loc, "example.catalog", NIL);
  44.  
  45.  For StrNum:=0 to 2 do
  46.   Begin
  47.    Str := DefStrings[StrNum];
  48.    If cat<>NIL then Str := GetCatalogStr(cat, StrNum, "Catalog fehlerhaft.");
  49.    Writeln(Str);
  50.   end;
  51.  
  52.  CleanExit(NIL,0);
  53. end.
  54.  
  55.  
  56.  
  57.